package cn.taobaoke.restful.domain;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author yangzuo
 * @since 2017-03-25
 */
@Setter
@Getter
@ToString
@Entity
@Table(name = "tb_config")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GlobalConfig1 implements Serializable {

    public GlobalConfig1() {}

    public GlobalConfig1(GlobalConfig entity, Long domainId) {
        this.id = entity.getId();
        this.type = entity.getType();
        this.globalConfig = entity.getGlobalConfig();
        this.logoUrl = entity.getLogoUrl();
        this.title = entity.getTitle();
        this.domainId = domainId;
    }

    public static final String CONFIG_TYPE_DEFAULT = "default";

    @Id
    @GeneratedValue
    private Long id;

    @Column
    private String type; // 内容为'default'

    @Column(length = 3000)
    private String globalConfig; // 全局配置

    @Column
    private String logoUrl;     // 商品logo

    @Column
    private String title;       // 商品title

    @Column
    private Long domainId;

    @Transient
    public static final String TJ_PID = "mm_120456523_22556802_74748128";
}
